import service from "@/utils/request"
import LoginWork from "@/utils/LoginWork"
// 所有部门资料
export interface AllDepartments {
    companyId: string,
    deptNo: string,
    deptName: string,
    engName: null,
    remark: null,
    totalFlag: null,
    deptFlag: null,
    deptLevel: number,
    parentLevel: null,
    factory: string,
    deptPersons: null,
    childDepartment: FirstlevelRouting[],
}


interface FirstlevelRouting {
    companyId: string,
    deptNo: string,
    deptName: string,
    engName: null,
    remark: null,
    totalFlag: null,
    deptFlag: null,
    deptLevel: number,
    parentLevel: string,
    factory: string,
    deptPersons: null,
    childDepartment: FirstlevelRouting [] | null 
}

 
export const  AllDepartmentData = () => {
    return service.get<any,AllDepartments[]>('/dept/GetAllData')
}

// 添加部门
export const AddDepartment = (data:any) => {
    return LoginWork.post<any,any>('/dept/AddDepartmentInfo',data) 
}

// 删除
export const DeleteDepartment = (data:any) => {
   return LoginWork.post<any,any>('/dept/delDepartmentInfo',data) 
}